<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 利用对象封装自己的数学对象，里面有PI的最大值最小值
        var myMath ={
            PI:3.1415926,
            max:function(){
                var max =  arguments[0];
                for(var i = 0; i<arguments.length;i++){
                    if(arguments[i]>max){
                        max = arguments[i]
                    }
                }
                return max;
            },
            min:function(){
                var min =  arguments[0];
                for(var i = 0; i < arguments.length;i++){
                    if(arguments[i]<min){
                        min = arguments[i]
                    }
                }
                return min;
            }
        }
        console.log(myMath.PI);
        console.log(myMath.max(12,3,2));
        console.log(myMath.min(12,3,2));

        //绝对值的方法
        console.log(Math.abs(1));
        console.log(Math.abs('-1'));//隐式转换 会把字符串型-1转换为数字型
        console.log('didi');//NaN
    </script>
</body>
</html>